<template>
	<view class="">
		<view class="fin_tabs">
			<view style="width: 80%;">
				<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"
					active-color="#F3060D"></u-tabs>
			</view>
			<image class="fin_img" src="@/static/more.png"></image>
		</view>
		<view class="spacing">
			<view class="fin_zj">
				<view style="display: flex;">
					<view class="fin_all" v-for="(item,index) in datalist" :key="index">
						<image class="fin_img" :src="item.img"></image>
						<view class="fin_title">{{item.title}}</view>
					</view>
				</view>
				<image @click="show = true" class="fin_imgr" src="@/static/datapick.png"></image>
			</view>
			<view class="application">
				<view class="application_l">账户余额:￥99999.99</view>
				<view class="application_r" v-if="current == 2">
					<view class="application_r_l">申请分账</view>
					<image @click="toCollect" style="width: 32rpx;height: 32rpx;" class="fin_rs"
						src="@/static/down.png">
					</image>
				</view>
			</view>
		</view>
		<view class="spacing" v-if="current==0">
			<view class="order_im" v-for="(item,index) in billList" :key="index">
				<view class="imga">
					<image class="information_img" src="@/static/commodity.png"></image>
				</view>
				<view class="imga_r">
					<view>
						<view class="imga_r_o">
							<view class="imga_r_size">用户购买商品</view>
							<view class="imga_r_dps">+￥19.9</view>
						</view>
						<view class="imga_mc">商品名称</view>
					</view>

					<view class="imga_bot">
						<view class="imga_bot_num">时间:2024-4-14 12:00:00</view>
					</view>
				</view>
			</view>
		</view>
		<view class="spacing" v-if="current==1">
			<view class="order_im" v-for="(item,index) in flowingList" :key="index">
				<view class="imga">
					<image class="information_img" src="@/static/Water_r.png"></image>
				</view>
				<view class="imga_r">
					<view>
						<view class="imga_r_o">
							<view class="imga_r_size">金维总店</view>
							<view class="imga_r_dps">-￥19.9</view>
						</view>
					</view>
					<view class="imga_bot">
						<view class="imga_bot_num">时间:2024-4-14 12:00:00</view>
					</view>
				</view>
			</view>
		</view>
		<view style="padding: 0rpx 28rpx" v-if="current==2" v-for="(item,index) in divideList" :key="index">
			<view class="Splitting">
				<view class="Splitting_top">审核中</view>
				<view class="Splitting_ce">
					<view class="Splitting_ce_l">转账记录</view>
					<view class="Splitting_ce_r">￥19.9</view>
				</view>
				<view class="Splitting_bott">时间:2024-4-14 12:00:00</view>
			</view>
		</view>
		<view style="padding: 0rpx 28rpx" v-if="current==3" v-for="(item,index) in divideList" :key="index">
			<view class="Splitting">
				<view class="Splitting_top">审核不通过</view>
				<view class="Splitting_ce">
					<view class="Splitting_ce_l">转账记录</view>
					<view class="Splitting_ce_r">￥19.9</view>
				</view>
				<view class="Splitting_bott">时间:2024-4-14 12:00:00</view>
				<view class="Splitting_msg">备注:金额错误</view>
			</view>
		</view>
		<view>
			<u-popup v-model="show" mode="bottom" :closeable="true">
				<view class="popup_top">请选择数据时间段</view>
				<image class="popup_xian" src="@/static/-.png"></image>
				<view class="popup_time">
					<view class="popup_times">
						<view class="popup_times_r">开始时间:{{year}}年{{month}}月{{day}}日</view>
						<view class="popup_times_xian">-</view>
						<view class="popup_times_r">结束时间:{{year}}年{{month}}月{{day}}日</view>
					</view>
				</view>
				<view class="picker_s">
					<picker-view v-if="visible" :indicator-style="indicatorStyle" :value="value" @change="bindChange"
						class="picker-view">
						<picker-view-column>
							<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
						</picker-view-column>
						<picker-view-column>
							<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
						</picker-view-column>
						<picker-view-column>
							<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
						</picker-view-column>
					</picker-view>
					<picker-view v-if="visible" :indicator-style="indicatorStyle" :value="value" @change="bindChange"
						class="picker-view">
						<picker-view-column>
							<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
						</picker-view-column>
						<picker-view-column>
							<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
						</picker-view-column>
						<picker-view-column>
							<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
						</picker-view-column>
					</picker-view>
				</view>
				<view class="picker_btn">
					<view class="btn_cancel">取消</view>
					<view class="btn_confirm">确定</view>
				</view>
				<view class="btn_xian"></view>
				<view style="padding: 0rpx 37rpx 40rpx 37rpx;">
					<view class="dc_btn">导出</view>
				</view>
				<!-- <u-button>打开</u-button> -->
			</u-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			const date = new Date()
			const years = []
			const year = date.getFullYear()
			const months = []
			const month = date.getMonth() + 1
			const days = []
			const day = date.getDate()
			for (let i = 1990; i <= date.getFullYear(); i++) {
				years.push(i)
			}
			for (let i = 1; i <= 12; i++) {
				months.push(i)
			}
			for (let i = 1; i <= 31; i++) {
				days.push(i)
			}
			return {
				years,
				year,
				months,
				month,
				days,
				day,
				value: [9999, month - 1, day - 1],
				visible: true,
				indicatorStyle: `height: 50px;`,
				list: [{
						name: '财务账单'
					}, {
						name: '财务流水'
					}, {
						name: '分账列表',
					},
					// {
					// 	name: '转账列表',
					// }
				],
				datalist: [{
						img: '../../static/shaixuan.png',
						title: '每日'
					},
					{
						img: '../../static/shaixuan.png',
						title: '每月'
					},
					{
						img: '../../static/shaixuan.png',
						title: '每年'
					}
				],
				current: 0,
				show: false,
				billList:[],
				flowingList:[],
				divideList:[]
			}
		},
		methods: {
			getBillList(){
				this.$api.request({
					url: 'bills',
					method: 'GET',
					data: {
						type:'',
				/* 		size:20
						page:1 */
						
					}
				}).then(res => {
					console.log('res', res);
					if (res.code == 200) {
						console.log(res.data);
				/* 		this.total = res.meta.pagination.total
						this.page = this.page + 1
						this.dataList=this.dataList.concat(res.data); */
						this.billList=res.data;
					}
				}).catch(err => {
					console.error(error);
				});
			},
			getFlowingList(){
				this.$api.request({
					url: 'financials',
					method: 'GET',
					data: {
						type:'',
					/* 	size:20
						page:1 */
						
					}
				}).then(res => {
					console.log('res', res);
					if (res.code == 200) {
						console.log(res.data);
				/* 		this.total = res.meta.pagination.total
						this.page = this.page + 1 */
					/* 	this.dataList=this.dataList.concat(res.data); */
					this.flowingList=res.data;
					}
				}).catch(err => {
					console.error(error);
				});
			},
			getDivideList(){
				this.$api.request({
					url: 'separate/accounts',
					method: 'GET',
					data: {
			
					}
				}).then(res => {
					console.log('res', res);
					if (res.code == 200) {
						console.log(res.data);
			/* 			this.total = res.meta.pagination.total
						this.page = this.page + 1 */
						/* this.dataList=this.dataList.concat(res.data); */
						this.divideList=res.data;
					}
				}).catch(err => {
					console.error(error);
				});
			},
			change(index) {
				this.current = index;
			},
			bindChange(e) {
				const val = e.detail.value
				this.year = this.years[val[0]]
				this.month = this.months[val[1]]
				this.day = this.days[val[2]]
			},
			toCollect() {
				uni.navigateTo({
					url: '/pages/finance/Collection'
				})
			}
		}
	}
</script>
<style>
	page {
		background: #F4F5F7;
	}
</style>
<style scoped lang="scss">
	.fin_tabs {
		background: #fff;
		display: flex;
		align-items: center;
		margin-bottom: 25rpx;

		.fin_img {
			width: 40rpx;
			height: 40rpx;
			margin-left: 84rpx;
		}
	}

	.spacing {
		padding: 0rpx 28rpx;
	}

	.fin_zj {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 28rpx;

		.fin_all {
			display: flex;
			align-items: center;
			margin-right: 32rpx;

			.fin_img {
				width: 32rpx;
				height: 32rpx;
				margin-right: 4rpx;
			}

			.fin_title {
				font-size: 28rpx;
				font-weight: 400;
				line-height: 39rpx;
				color: #1E1E1E;
			}
		}

		.fin_imgr {
			width: 32rpx;
			height: 32rpx;
		}
	}

	.application {
		background: #FFF;
		padding: 10rpx 15rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.application_l {
			font-size: 28rpx;
			font-weight: 400;
			line-height: 39rpx;
			color: #1E1E1E;
		}

		.application_r {
			display: flex;
			align-items: center;

			.application_r_l {
				font-size: 28rpx;
				font-weight: 400;
				line-height: 39rpx;
				color: #1E1E1E;
				margin-right: 10rpx;
			}
		}
	}

	.order_im {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 20rpx 0rpx;
		padding: 30rpx;
		background: #FFF;
		border-radius: 10rpx;

		.imga {
			margin-right: 27rpx;

			.information_nn {
				height: 36rpx;
				border-radius: 10rpx 0rpx 10rpx 0rpx;
				background: rgba(243, 6, 13, 1);
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 20rpx;
				line-height: 28rpx;
				color: #FFF;
				position: absolute;
			}

			.information_ns {
				width: 78rpx;
				height: 36rpx;
				border-radius: 0rpx 0rpx 10rpx 0rpx;
				background: rgba(243, 6, 13, 1);
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 20rpx;
				line-height: 28rpx;
				color: #FFF;
				position: absolute;
				top: 44rpx;
			}

			.information_img {
				width: 180rpx;
				height: 180rpx;
				border-radius: 10rpx;
			}
		}

		.imga_r {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			height: 180rpx;
			width: 100%;

			.imga_r_o {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 14rpx;

				.imga_r_size {
					font-size: 26rpx;
					font-weight: 400;
					line-height: 36rpx;
					color: #1E1E1E;
				}

				.imga_r_dps {
					font-size: 24rpx;
					line-height: 33rpx;
					font-weight: 400;
					color: #F3060D;
				}
			}

			.imga_mc {
				font-size: 24rpx;
				line-height: 33rpx;
				font-weight: 400;
				color: #999999;
			}

			.imga_bot {
				.imga_bot_num {
					font-size: 24rpx;
					font-weight: 400;
					line-height: 33rpx;
					color: #999999;
				}

				.imga_bot_mon {
					font-size: 30rpx;
					line-height: 42rpx;
					color: #E93E30;
				}
			}
		}
	}

	.Splitting {
		background: #FFF;
		margin: 20rpx 0rpx 20rpx 0rpx;
		position: relative;
		padding: 54rpx 20rpx 15rpx 15rpx;
		border-radius: 10rpx;

		.Splitting_top {
			position: absolute;
			top: 0;
			left: 0;
			padding: 4rpx 34rpx;
			height: 42rpx;
			background: #F3060D;
			border-radius: 10rpx 0rpx 10rpx 0rpx;
			font-size: 24rpx;
			font-weight: 500;
			line-height: 33rpx;
			color: #FFFFFF;
		}

		.Splitting_ce {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 12rpx;

			.Splitting_ce_l {
				font-size: 26rpx;
				font-weight: 400;
				line-height: 40rpx;
				color: #1E1E1E;
			}

			.Splitting_ce_r {
				font-size: 24rpx;
				font-weight: 400;
				line-height: 33rpx;
				color: #F3060D;
			}
		}

		.Splitting_bott {
			font-size: 24rpx;
			font-weight: 400;
			line-height: 33rpx;
			color: #999999;
			margin-bottom: 10rpx;
		}
		.Splitting_msg{
			font-size: 24rpx;
			font-weight: 400;
			line-height: 33rpx;
			color: #999999;
		}
	}

	.popup_top {
		text-align: center;
		padding-top: 30rpx;
		margin-bottom: 15rpx;
	}

	.popup_xian {
		width: 100%;
		height: 1rpx;
		background: #F9F9F9;
		margin-bottom: 15rpx;
	}

	.popup_time {
		display: flex;
		align-items: center;
		justify-content: center;
		// margin-bottom: 33rpx;

		.popup_times {
			// width: 522rpx;
			height: 44rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.popup_times_r {
				height: 44rpx;
				border-radius: 5rpx;
				background: #F9F9F9;
				padding: 5rpx 30rpx;
				text-align: center;
				font-size: 24rpx;
				font-weight: 500;
				line-height: 33rpx;
				color: #A6A6A6;
			}

			.popup_times_xian {
				width: 15rpx;
				height: 34rpx;
				margin: 0rpx 24rpx;
			}
		}
	}

	.picker_s {
		display: flex;
		padding: 0rpx 20rpx;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 30rpx;
	}

	.picker_btn {
		display: flex;
		padding: 0rpx 20rpx;
		justify-content: flex-end;

		.btn_cancel {
			width: 200rpx;
			height: 75rpx;
			border-radius: 5px;
			background: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 400;
			line-height: 39rpx;
			color: #EE3535;
			border: 2rpx solid #EE3535;
			margin-right: 30rpx;
		}

		.btn_confirm {
			width: 200rpx;
			height: 75rpx;
			border-radius: 5rpx;
			background: #EE3535;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			font-weight: 500;
			line-height: 39rpx;
			color: #FFF;
		}
	}

	.btn_xian {
		width: 100%;
		height: 1rpx;
		background: #F9F9F9;
		margin: 20rpx 0rpx;
	}

	.dc_btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 88rpx;
		border-radius: 44rpx;
		background: linear-gradient(147.27deg, #F1714E 0%, #E93E30 100%);
		font-size: 32rpx;
		font-weight: 500;
		line-height: 44rpx;
		color: #FFFFFF;
	}

	uni-picker-view {
		display: block;
	}

	uni-picker-view .uni-picker-view-wrapper {
		display: flex;
		position: relative;
		overflow: hidden;
		height: 100%;
		background-color: white;
	}

	uni-picker-view[hidden] {
		display: none;
	}

	picker-view {
		width: 348rpx;
		height: 360rpx;
		margin-top: 20upx;
		// border: 2rpx solid #A6A6A6;
	}

	.item {
		line-height: 100upx;
		text-align: center;
	}
</style>